<template>
	<view class="content">
		<view class="block list-block">
			<template v-if="list.length>0">
				<view @click="goView(item.com.enterprise.id)" class="list-item person-item" v-for="(item,index) in list"
					:key="item.id">
					<view class="info-block">
						<image :src="item.com.enterprise.logoUrl" class="user-photo"></image>
						<view class="info">
							<view class="name">{{item.com.enterprise.enterpriseName}}</view>
							<view class="other">查看时间:{{item.crtTime}}</view>
						</view>
					</view>
				</view>
			</template>
			<!-- 底部加载提示 -->
			<view v-else-if="list.length>0&&!more" style="text-align: center;">没有更多了哦</view>
			<view v-else style="text-align: center;">暂无数据</view>
		</view>
	</view>
</template>

<script>
	import {
		getStorage
	} from '@/util/auth.js';
	import {
		getLookMeFindByCidList
	} from '@/api/count_details.js';
	import {
		isMore
	} from '@/util/util.js'
	import util from '@/util/util.js';
	export default {
		data() {
			return {
				imageUrl: '',
				page: 1,
				limit: 10,
				more: true,
				total: 0,
				list: [],
			}
		},
		methods: {
			refresh() {
				this.page = 1
				this.more = true
				this.getList(true);
			},
			async getList(refresh = false) {
				if (this.more) {
					let config = {
						page: this.page,
						limit: this.limit,
						userType: 1,
						lookMeType: 1,
					}
					uni.showLoading({
						title: '加载中',
						mask: true
					})
					let res = await getLookMeFindByCidList(config)
					let list = res.list ?? [];
					this.list = refresh ? list : [...this.list, ...list],
						this.total = res.count
					this.more = isMore(this.page, this.limit, this.total)
				}
			},
			goView(id) {
				uni.navigateTo({
					url: '/page_other/company/company?type=view&id=' + id
				})
			},
		},


		onLoad() {
			this.imageUrl = this.globalConfig.imageUrl;
			this.getList(true);
		},
		onPullDownRefresh() {
			this.refresh();
			uni.stopPullDownRefresh();
		},
		onReachBottom() {
			if (this.more) {
				this.page++;
				this.getList()
			}
		},
	}
</script>

<style lang="scss">
	$box-shadow: 0 0 10px 0 #efefef;

	page {
		background: #FAFAFA;
	}

	.content {
		width: 100%;
		padding: 30rpx;

		.loadingicon {
			width: 100%;
			height: 80rpx;
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			justify-content: center;
		}

		.loading {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			align-items: center;
			justify-content: center;
			position: relative;
			text-align: center;
		}

		.loading .line {
			position: absolute;
			width: 450rpx;
			left: 150rpx;
			top: 50rpx;
			height: 1px;
			border-top: 1px solid #eee;
		}

		.loading .text {
			position: relative;
			display: inline-block;
			padding: 0 20rpx;
			background: #fff;
			z-index: 2;
			color: #777;
		}

		.loadingicon .loading {
			animation: load linear 1s infinite;
			font-size: 45rpx;
			color: #000;
		}

		.loadingicon {
			width: 100%;
			height: 80rpx;
		}

		.block {
			width: 100%;
			margin-bottom: 20rpx;
			position: relative;
		}

		.block.list-block {
			box-shadow: none;
			display: flex;
			flex-direction: column;
			margin-bottom: 0;

			.list-item {
				width: 100%;
				background: #fff;
				border-radius: 10rpx;
				box-shadow: $box-shadow;
				padding: 20rpx;
				display: flex;
				flex-direction: row;
				justify-content: center;
				margin-bottom: 20rpx;

				.detail-info {
					width: 180rpx;
					height: 200rpx;
					display: flex;
					flex-direction: row;
					flex-wrap: wrap;
					justify-content: center;
					align-items: center;

					.name {
						width: 110rpx;
						font-size: 24rpx;
						color: #999;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						text-align: center;
						text-indent: 20rpx;
					}

					.photo {
						width: 70rpx;
						height: 70rpx;
						border-radius: 100%;
						background: #efefef;
					}

					.apply-btn {
						border: 1px solid #FE7526;
						border-radius: 8rpx;
						color: #FE7526;
						font-size: 24rpx;
						padding: 8rpx 28rpx;
						position: relative;
						left: 30rpx;
					}
				}

				.list-info {
					width: calc(100% - 180rpx);
					display: flex;
					flex-direction: column;

					>view {
						width: 100%;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.title {
						color: #000;
						font-weight: bold;
						font-size: 34rpx;
					}

					.address {
						color: #999;
						font-size: 26rpx;
						margin-top: 20rpx;
					}

					.label-block {
						font-size: 24rpx;
						display: flex;
						flex-direction: row;
						flex-wrap: wrap;
						justify-content: left;
						margin-top: 20rpx;

						.label-item {
							padding: 8rpx 20rpx;
							background: #F5F6F8;
							color: #999;
							margin: 0 10rpx 20rpx 0;
						}
					}

					.wage {
						color: #FE7526;
						font-size: 36rpx;
						font-weight: bold;

						.unit {
							font-size: 28rpx;
							font-weight: normal;
						}
					}
				}
			}

			.list-item:last-child {
				margin-bottom: 0;
			}

			.person-item {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				padding: 0 30rpx;
				margin-bottom: 30rpx;

				.info-block,
				.job-block {
					width: 100%;
					padding: 20rpx 0;
				}

				.info-block {
					border-bottom: 1px solid #efefef;
					display: flex;
					flex-direction: row;
					align-items: center;

					.user-photo {
						width: 100rpx;
						height: 100rpx;
						border-radius: 50%;
					}

					.info {
						width: calc(100% - 120rpx);
						margin-left: 20rpx;

						.name {
							font-weight: bold;
							font-size: 34rpx;
						}

						.other {
							font-size: 26rpx;
							color: #999;
							margin-top: 14rpx;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
						}
					}
				}

				.job-block {
					display: flex;
					flex-direction: row;
					align-items: center;

					.job {
						width: calc(100% - 140rpx);
						display: flex;
						flex-direction: column;
						justify-content: center;

						.label-block {
							width: 100%;
							display: flex;
							flex-direction: row;
							flex-wrap: wrap;

							.label-item {
								background: #F4F5F7;
								color: #999;
								font-size: 24rpx;
								padding: 4rpx 10rpx;
								margin-right: 20rpx;
								margin-bottom: 20rpx;
							}
						}

						.job-content {
							width: 100%;
							font-size: 26rpx;
						}
					}

					.btn-block {
						width: 140rpx;
						display: flex;
						align-items: center;
						justify-content: center;

						.btn {
							padding: 6rpx 26rpx;
							border: 1px solid #FE7526;
							border-radius: 6rpx;
							color: #FE7526;
							font-size: 24rpx;
						}
					}
				}
			}

			.person-item:last-child {
				margin-bottom: 0;
			}
		}
	}
</style>
